package com.dlry.entity;
// Generated 2016-10-31 13:57:37 by Hibernate Tools 3.6.0.Final

import java.sql.Timestamp;
import java.text.SimpleDateFormat;

import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * DlNotification generated by hbm2java
 */
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "entityCache")
@Cacheable(true)
@Entity
@Table(name = "dl_notification")
public class DlNotification implements java.io.Serializable {

	/**
	 * 
	 */
	@Transient
	private static final long serialVersionUID = -3293777503378176379L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
	@Column(name = "title", length = 100, nullable = true)
	private String title;
	@Column(name = "createtime")
	private Timestamp createtime;
	@Column(name = "updatetime")
	private Timestamp updatetime;
	@Column(name = "detail")
	private String detail;
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "user_id")
	private DlLoginuser user;
	@Column(name = "top")
	private boolean toped = false;

	public void setToped(boolean toped) {
		this.toped = toped;
	}

	public boolean isToped() {
		return toped;
	}

	public DlLoginuser getUser() {
		return user;
	}

	public void setUser(DlLoginuser user) {
		this.user = user;
	}

	public DlNotification() {
	}

	public DlNotification(String title) {
		this.title = title;
	}

	public DlNotification(String title, Timestamp createtime, Timestamp updatetime, String detail) {
		this.title = title;
		this.createtime = createtime;
		this.updatetime = updatetime;
		this.detail = detail;
	}

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public Timestamp getCreatetime() {
		return this.createtime;
	}

	public void setCreatetime(Timestamp createtime) {
		this.createtime = createtime;
	}

	public Timestamp getUpdatetime() {
		return this.updatetime;
	}

	public void setUpdatetime(Timestamp updatetime) {
		this.updatetime = updatetime;
	}

	public String getInfo() {
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
		String datestr = format.format(updatetime);
		return title + " " + datestr;
	}

	public String getTimestr() {
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
		String datestr = format.format(updatetime);
		return datestr;
	}

	// public int getUserId() {
	// return this.userId;
	// }
	//
	// public void setUserId(int userId) {
	// this.userId = userId;
	// }

	public String getDetail() {
		return this.detail;
	}

	public void setDetail(String detail) {
		this.detail = detail;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

}
